home *** CD-ROM | disk | FTP | other *** search
/ Essentials of Interactive Physiology / Essentials of Interactive Physiology.iso / pc / files / evaluation / evaluation.dcr / 00002_quizParent.ls < prev    next >
Encoding:
Text File  |  2002-04-02  |  20.9 KB  |  650 lines

  1. property poDotMan, pkMaxDigits, poChapterBtnGroup, poStartBtn, poPrintBtn, poNumQuestionsRadio, poPrev, poTop, poNext, poQuestionTemplate, poRightQuestions, poWrongQuestions, piFirstSummarySprite, piLastSummarySprite, poOwner, psChapterQuestions, plRightWrong, piNumChapters, piNumQuestionsAvailable, piNumQuestions, piNumAnswers, piCurChapter, piCurQuestion, piCurChapterQuestion, piCorrectAnswer, piTotalCorrect, plQuestionsAnswerOrder, plFirstAnswer, pzEvalType, pliChapters, plpTestQuestions, piNumQuestonsAnswered, poPrintEvaluation
  2.  
  3. on new me, xoDotMan, xzEvalType, xzNumQuestions, xiChapter
  4.   poDotMan = xoDotMan
  5.   pzEvalType = xzEvalType
  6.   piNumQuestions = xzNumQuestions
  7.   piCurChapter = xiChapter
  8.   poPrintEvaluation = new(script("printMCEvaluationParent"), me, 6, 1)
  9.   return me
  10. end
  11.  
  12. on mInit me, xInfo
  13.   mInitVars(me, xInfo)
  14.   if not voidp(piCurChapter) then
  15.     pliChapters = [piCurChapter]
  16.     mClearChapterSelection(me)
  17.     mInitQuestions(me)
  18.     mInitNumberFields(me)
  19.     mInitButtons(me, pzEvalType, "prev", "next")
  20.     mSetButtonState(me)
  21.   else
  22.     mInitEvalStart(me)
  23.   end if
  24. end
  25.  
  26. on mInitVars me, xInfo
  27.   piNumQuestionsAvailable = getaProp(xInfo, #numAvailable)
  28.   piNumChapters = getaProp(xInfo, #numChapters)
  29.   piNumAnswers = 4
  30.   pkMaxDigits = 2
  31.   pliChapters = []
  32.   if pzEvalType = #test then
  33.     set the text of field "testRightScroll" to EMPTY
  34.     set the text of field "testWrongScroll" to EMPTY
  35.   end if
  36.   member("fromChapterText").text = EMPTY
  37. end
  38.  
  39. on mInitEvalStart me
  40.   mResetDots(poDotMan)
  41.   mInitBkg(me, string(pzEvalType) & "BG")
  42.   viSprite = mGiveDot(poDotMan)
  43.   poStartBtn = InitPopBtn(me, viSprite, "start" & string(pzEvalType), #mStartBtnClick, VOID, "clickSnd")
  44.   mSetState(poStartBtn, #gray)
  45.   mDisable(poStartBtn, 1)
  46.   viSprite = mGiveDot(poDotMan)
  47.   poPrintBtn = InitPopBtn(me, viSprite, "Print" & string(pzEvalType), #mPrintBtnClick, #clean, "clickSnd")
  48.   mSetState(poPrintBtn, #gray)
  49.   mDisable(poPrintBtn, 1)
  50.   mInitChapterSelectionBtns(me)
  51.   if pzEvalType = #test then
  52.     mInitNumQuestionsRadio(me)
  53.   end if
  54. end
  55.  
  56. on mInitBkg me, xsMember
  57.   viSprite = mGiveDot(poDotMan)
  58.   set the member of sprite viSprite to xsMember
  59. end
  60.  
  61. on mInitButtons me
  62.   case pzEvalType of
  63.     #quiz:
  64.       vsMemberTop = "showAnswer"
  65.     #test:
  66.       vsMemberTop = "doneTest"
  67.   end case
  68.   viSprite = mGiveDots(poDotMan, 3)
  69.   poTop = InitPopBtn(me, viSprite, vsMemberTop, symbol(vsMemberTop), VOID, "clickSnd")
  70.   poPrev = InitPopBtn(me, viSprite + 1, "back", #mPrevBtnClick, VOID, "clickSnd")
  71.   poNext = InitPopBtn(me, viSprite + 2, "next", #mNextBtnClick, VOID, "clickSnd")
  72. end
  73.  
  74. on mInitChapterSelectionBtns me
  75.   case pzEvalType of
  76.     #quiz:
  77.       vsButtonType = "Radio"
  78.     #test:
  79.       vsButtonType = "Toggle"
  80.   end case
  81.   vsMember = string(pzEvalType) & "Circle"
  82.   poChapterBtnGroup = new(script("BtnGroupWLabelParent"), vsButtonType, vsMember, "chapterSpacer", "chapterLabel", poDotMan, piNumChapters, pkMaxDigits)
  83.   mSetOwner(poChapterBtnGroup, me)
  84.   mSetEvent(poChapterBtnGroup, #chapterSelectionClick)
  85. end
  86.  
  87. on mInitNumQuestionsRadio me
  88.   poNumQuestionsRadio = new(script("BtnGroupWLabelParent"), "Radio", string(pzEvalType) & "Circle", "NumQuestionRadioSpacer", "QuestionLabel", poDotMan, 5, pkMaxDigits)
  89.   mSetOwner(poNumQuestionsRadio, me)
  90.   mSetEvent(poNumQuestionsRadio, #numQuestionsRadioBtn)
  91.   mDisable(poNumQuestionsRadio, 0)
  92.   mDepressABtn(poNumQuestionsRadio, 1)
  93. end
  94.  
  95. on mInitReviewQuestionBtns me
  96.   viSprite = mGiveDots(poDotMan, piNumQuestions)
  97.   repeat with i = 1 to piNumQuestions
  98.     vsResult = getAt(plRightWrong, i)
  99.     AlignCenteredSpriteToMember(viSprite + i - 1, "chapSpacer" & IntegerToString(i, pkMaxDigits))
  100.     voQuestionButton = new(script("NotifyOwnerParent"), viSprite + i - 1, "results" & vsResult)
  101.     mSetMyOwnerMyEventMyID(voQuestionButton, me, #questionReview, i)
  102.     set the cursor of sprite (viSprite + i - 1) to 280
  103.     add(the scriptInstanceList of sprite (viSprite + i - 1), voQuestionButton)
  104.   end repeat
  105. end
  106.  
  107. on mInitReviewScrollText me
  108.   viSprite = mGiveDots(poDotMan, 2)
  109.   if the text of field "testRightScroll" = EMPTY then
  110.     vsWrong = EMPTY
  111.     vsRight = EMPTY
  112.     repeat with i = 1 to piNumQuestions
  113.       vsResult = getAt(plRightWrong, i)
  114.       vsLine = "Question " & string(i) & " - Chapter " & string(getPropAt(plpTestQuestions, i))
  115.       if vsResult = "right" then
  116.         vsRight = vsRight & RETURN & vsLine
  117.         next repeat
  118.       end if
  119.       vsWrong = vsWrong & RETURN & vsLine
  120.     end repeat
  121.     delete line 1 of vsRight
  122.     delete line 1 of vsWrong
  123.     member("testWrongScroll").text = vsWrong
  124.     member("testRightScroll").text = vsRight
  125.   end if
  126.   set the member of sprite viSprite to "testRightScroll"
  127.   set the member of sprite (viSprite + 1) to "testWrongScroll"
  128.   member("testRightScroll").rect = member("testRightSpacer").rect
  129.   set the rect of sprite viSprite to member("testRightSpacer").rect
  130.   member("testWrongScroll").rect = member("testWrongSpacer").rect
  131.   set the rect of sprite (viSprite + 1) to member("testWrongSpacer").rect
  132.   AlignTextBoxToSpacer(viSprite, "testRightSpacer")
  133.   AlignTextBoxToSpacer(viSprite + 1, "testWrongSpacer")
  134.   if voidp(poRightQuestions) then
  135.     poRightQuestions = new(script("HotTextFieldParent"), viSprite, 1, me, "testRightScroll")
  136.     poWrongQuestions = new(script("HotTextFieldParent"), viSprite + 1, 2, me, "testWrongScroll")
  137.   end if
  138.   add(the scriptInstanceList of sprite viSprite, poRightQuestions)
  139.   add(the scriptInstanceList of sprite (viSprite + 1), poWrongQuestions)
  140.   mDisable(poRightQuestions, 0)
  141.   mDisable(poWrongQuestions, 0)
  142.   mSetNotifyOnMouseDown(poRightQuestions, 0)
  143.   mSetNotifyOnMouseDown(poWrongQuestions, 0)
  144.   mResetColour(poRightQuestions)
  145.   mResetColour(poWrongQuestions)
  146.   mShow(poRightQuestions)
  147.   mShow(poWrongQuestions)
  148. end
  149.  
  150. on mInitNumberFields me
  151.   viSprite = mGiveDot(poDotMan)
  152.   set the member of sprite viSprite to "question_num"
  153.   member("question_num").text = string(piCurQuestion)
  154.   AlignTextBoxToSpacer(viSprite, "QuestNumSpacer")
  155.   set the ink of sprite viSprite to 36
  156.   viSprite = mGiveDot(poDotMan)
  157.   member("total_questions").text = string(piNumQuestions)
  158.   set the member of sprite viSprite to "total_questions"
  159.   AlignTextBoxToSpacer(viSprite, "TotalQuestionsSpacer")
  160.   set the ink of sprite viSprite to 36
  161.   viSprite = mGiveDot(poDotMan)
  162.   member("total_correct").text = string(piTotalCorrect)
  163.   set the member of sprite viSprite to "total_correct"
  164.   AlignTextBoxToSpacer(viSprite, string(pzEvalType) & "TotalCorrectSpacer")
  165.   set the ink of sprite viSprite to 36
  166. end
  167.  
  168. on mSetButtonState me
  169.   if piCurQuestion = 1 then
  170.     mSetState(poPrev, #gray)
  171.     mDisable(poPrev, 1)
  172.   else
  173.     mSetState(poPrev, #Up)
  174.     mDisable(poPrev, 0)
  175.   end if
  176.   case pzEvalType of
  177.     #test:
  178.       mSetState(poTop, #Up)
  179.       mSetState(poNext, #Up)
  180.       mDisable(poTop, 0)
  181.       mDisable(poNext, 0)
  182.     #quiz:
  183.       if piCurQuestion <= piNumQuestonsAnswered then
  184.         mSetState(poTop, #Up)
  185.         mDisable(poTop, 0)
  186.         mSetState(poNext, #Up)
  187.         mDisable(poNext, 0)
  188.       else
  189.         mSetState(poTop, #gray)
  190.         mDisable(poTop, 1)
  191.         mSetState(poNext, #gray)
  192.         mDisable(poNext, 1)
  193.       end if
  194.   end case
  195. end
  196.  
  197. on mDisable me, xbDisable
  198.   mDisable(poPrev, xbDisable)
  199.   mDisable(poTop, xbDisable)
  200.   mDisable(poNext, xbDisable)
  201. end
  202.  
  203. on mClearChapterSelection me
  204.   mResetDots(poDotMan)
  205.   if not voidp(poStartBtn) then
  206.     mCleanUp(poStartBtn)
  207.     poStartBtn = VOID
  208.     mCleanUp(poChapterBtnGroup)
  209.     poChapterBtnGroup = VOID
  210.   end if
  211.   if not voidp(poNumQuestionsRadio) then
  212.     mCleanUp(poNumQuestionsRadio)
  213.     poNumQuestionsRadio = VOID
  214.   end if
  215. end
  216.  
  217. on mInitQuestions me
  218.   mInitBkg(me, string(pzEvalType) & "QuestBg")
  219.   poQuestionTemplate = new(script("questionParent"), poDotMan, me, piNumAnswers, pzEvalType, pkMaxDigits)
  220.   mInitQuestionTemplate(poQuestionTemplate, string(pzEvalType))
  221.   if voidp(piCurQuestion) then
  222.     mInitQuestionData(me)
  223.     mSelectQuestions(me)
  224.   end if
  225.   mStartNewQuestion(me)
  226.   piNumQuestonsAnswered = 0
  227. end
  228.  
  229. on mInitQuestionData me
  230.   piCurQuestion = 1
  231.   piCurChapterQuestion = 1
  232.   piTotalCorrect = 0
  233.   plRightWrong = []
  234.   plQuestionsAnswerOrder = []
  235.   plFirstAnswer = []
  236.   repeat with i = 1 to piNumQuestions
  237.     setAt(plFirstAnswer, i, 0)
  238.     append(plRightWrong, EMPTY)
  239.     vlAnswerOrder = GetRandomListFrom1toX(piNumAnswers)
  240.     addAt(plQuestionsAnswerOrder, i, duplicate(vlAnswerOrder))
  241.   end repeat
  242.   plAnswerOrder = getAt(plQuestionsAnswerOrder, 1)
  243. end
  244.  
  245. on mSelectQuestions me
  246.   viNumChapters = count(pliChapters)
  247.   viQuestionsPerChapter = integer(piNumQuestions / viNumChapters)
  248.   viRemainder = piNumQuestions - (viQuestionsPerChapter * viNumChapters)
  249.   plpTestQuestions = [:]
  250.   repeat with viChapter in pliChapters
  251.     if getPos(pliChapters, viChapter) <= viRemainder then
  252.       viNumQuestions = viQuestionsPerChapter + 1
  253.     else
  254.       viNumQuestions = viQuestionsPerChapter
  255.     end if
  256.     vsMemberName = IntegerToString(viChapter, 2)
  257.     viNumQuestionsAvailable = the number of lines in the text of member vsMemberName
  258.     vlNumberList = GetListFrom1toX(viNumQuestionsAvailable)
  259.     repeat with i = 1 to viNumQuestions
  260.       viQuestion = random(count(vlNumberList))
  261.       viQuestion = getAt(vlNumberList, viQuestion)
  262.       deleteOne(vlNumberList, viQuestion)
  263.       addProp(plpTestQuestions, viChapter, viQuestion)
  264.     end repeat
  265.   end repeat
  266.   plpTestQuestions = RandomizePropertyList(plpTestQuestions, piNumQuestions)
  267. end
  268.  
  269. on mStartNewQuestion me
  270.   member("question_num").text = string(piCurQuestion)
  271.   piCurChapter = getPropAt(plpTestQuestions, piCurQuestion)
  272.   piCurChapterQuestion = getAt(plpTestQuestions, piCurQuestion)
  273.   psChapterQuestions = member(IntegerToString(piCurChapter, pkMaxDigits)).text
  274.   vsQuestion = line piCurChapterQuestion of psChapterQuestions
  275.   vlAnswerOrder = getAt(plQuestionsAnswerOrder, piCurQuestion)
  276.   vlAnswerOrder = mSetQuestionData(poQuestionTemplate, vsQuestion, vlAnswerOrder)
  277. end
  278.  
  279. on mResetAnsweredQuestion me
  280.   viWhich = getAt(plFirstAnswer, piCurQuestion)
  281.   if pzEvalType = #quiz then
  282.     mMarkAnswer(poQuestionTemplate, viWhich)
  283.   end if
  284.   if viWhich then
  285.     mSelectAnswer(poQuestionTemplate, viWhich)
  286.   end if
  287. end
  288.  
  289. on mReviewAQuestion me, xiNextQuestion
  290.   piCurQuestion = xiNextQuestion
  291.   mStartNewQuestion(me)
  292.   mSetFromChapter(poQuestionTemplate, getPropAt(plpTestQuestions, piCurQuestion))
  293.   mShowAnswer(poQuestionTemplate)
  294.   viWhich = getAt(plFirstAnswer, piCurQuestion)
  295.   mSelectAnswer(poQuestionTemplate, viWhich)
  296.   mMarkAnswer(poQuestionTemplate, viWhich)
  297.   mDisable(poQuestionTemplate, 1)
  298.   if pzEvalType = #test then
  299.     mHide(poPrev)
  300.     mHide(poNext)
  301.   end if
  302. end
  303.  
  304. on mDisplaySummary me
  305.   mInitBkg(me, string(pzEvalType) & "SummaryBG")
  306.   piFirstSummarySprite = mGetLastDotGiven(poDotMan)
  307.   set the ink of sprite piFirstSummarySprite to 0
  308.   if pzEvalType = #quiz then
  309.     mInitReviewQuestionBtns(me)
  310.   else
  311.     mInitReviewScrollText(me)
  312.   end if
  313.   viSprite = mGiveDot(poDotMan)
  314.   member("total_correct").text = string(piTotalCorrect)
  315.   set the member of sprite viSprite to "total_correct"
  316.   AlignTextBoxToSpacer(viSprite, "summaryTotalCorrectSpacer")
  317.   set the ink of sprite viSprite to 36
  318.   viSprite = mGiveDot(poDotMan)
  319.   member("total_correct_percentage").text = string(integer(100 * piTotalCorrect / piNumQuestions))
  320.   set the member of sprite viSprite to "total_correct_percentage"
  321.   AlignTextBoxToSpacer(viSprite, "TotalCorrectPercentageSpacer")
  322.   set the ink of sprite viSprite to 36
  323.   viSprite = mGiveDot(poDotMan)
  324.   poPrintBtn = InitPopBtn(me, viSprite, "Print" & string(pzEvalType) & "Results", #mPrintBtnClick, #result, "clickSnd")
  325.   piLastSummarySprite = mGetLastDotGiven(poDotMan)
  326. end
  327.  
  328. on mDonePrint
  329.   mSetState(poPrintBtn, #Up)
  330.   mDisable(poPrintBtn, 0)
  331.   if poStartBtn <> VOID then
  332.     mSetState(poStartBtn, #Up)
  333.     mDisable(poStartBtn, 0)
  334.   end if
  335.   cursor(0)
  336. end
  337.  
  338. on mHandleNumQuestions me, xiID
  339.   piNumQuestions = xiID * 20
  340. end
  341.  
  342. on mHandleChapterSelectionClick me, xiChapter
  343.   piCurChapter = xiChapter
  344.   if mGetState(poStartBtn) = #gray then
  345.     mSetState(poStartBtn, #Up)
  346.     mDisable(poStartBtn, 0)
  347.     mSetState(poPrintBtn, #Up)
  348.     mDisable(poPrintBtn, 0)
  349.   end if
  350. end
  351.  
  352. on mHandlePrintBtnClick me, xzWhich
  353.   mSetState(poPrintBtn, #gray)
  354.   mDisable(poPrintBtn, 1)
  355.   if poStartBtn <> VOID then
  356.     mSetState(poStartBtn, #gray)
  357.     mDisable(poStartBtn, 1)
  358.   end if
  359.   cursor(4)
  360.   if not voidp(poChapterBtnGroup) then
  361.     pliChapters = mGetChosenID(poChapterBtnGroup)
  362.   end if
  363.   if ilk(pliChapters) <> #list then
  364.     pliChapters = [pliChapters]
  365.   end if
  366.   if mTotalNumQuestionsAvailable(me) < piNumQuestions then
  367.     alert("You have chosen too many questions for the number of chapters selected.")
  368.     pliChapters = []
  369.   else
  370.     if xzWhich = #clean then
  371.       mInitQuestionData(me)
  372.       mSelectQuestions(me)
  373.     end if
  374.     mSetHeaderFooter(poPrintEvaluation, pliChapters, string(pzEvalType), piNumQuestions)
  375.     mPrintEvaluation(poPrintEvaluation, xzWhich, plpTestQuestions, plQuestionsAnswerOrder, plFirstAnswer, plRightWrong)
  376.   end if
  377. end
  378.  
  379. on mTotalNumQuestionsAvailable me
  380.   viTotalAvailable = 0
  381.   repeat with i = 1 to count(pliChapters)
  382.     vsMemberName = IntegerToString(getAt(pliChapters, i), 2)
  383.     viNum = the number of lines in the text of member vsMemberName
  384.     viTotalAvailable = viTotalAvailable + viNum
  385.   end repeat
  386.   return viTotalAvailable
  387. end
  388.  
  389. on mHandleStartBtnClick me
  390.   pliChapters = mGetChosenID(poChapterBtnGroup)
  391.   if ilk(pliChapters) <> #list then
  392.     pliChapters = [pliChapters]
  393.   end if
  394.   if mTotalNumQuestionsAvailable(me) < piNumQuestions then
  395.     alert("You have choosen too many questions for the number of chapters selected.")
  396.     pliChapters = []
  397.   else
  398.     mClearChapterSelection(me)
  399.     mInitQuestions(me)
  400.     mInitNumberFields(me)
  401.     mInitButtons(me, pzEvalType, "prev", "next")
  402.     mSetButtonState(me)
  403.   end if
  404. end
  405.  
  406. on mHandleShowAnswer me
  407.   mShowAnswer(poQuestionTemplate)
  408. end
  409.  
  410. on mHandleDoneTest me
  411.   mHide(poNext)
  412.   mHide(poPrev)
  413.   mSetMemberName(poTop, string(pzEvalType) & "Summary")
  414.   mSetEvent(poTop, #returnToSummary)
  415.   mDisplaySummary(me)
  416. end
  417.  
  418. on mHandleTopBtnClick me, xzTop
  419.   case xzTop of
  420.     #newQuiz, #newTest:
  421.       pliChapters = []
  422.       set the text of field "curChoice" to "20"
  423.       set the text of field "testRightScroll" to EMPTY
  424.       set the text of field "testWrongScroll" to EMPTY
  425.       member("fromChapterText").text = EMPTY
  426.       deleteOne(the actorList, poRightQuestions)
  427.       deleteOne(the actorList, poWrongQuestions)
  428.       mInitSprites(me)
  429.       puppetTransition(3, 2, 2, 1)
  430.   end case
  431. end
  432.  
  433. on mHandlePrevBtnClick me, xOpcode
  434.   if piCurQuestion = 1 then
  435.     mNotify(poOwner, #mQuizToStage)
  436.   else
  437.     piCurQuestion = piCurQuestion - 1
  438.     mStartNewQuestion(me)
  439.     mResetAnsweredQuestion(me)
  440.     mSetButtonState(me)
  441.   end if
  442. end
  443.  
  444. on mHandleNextBtnClick me, xOpcode
  445.   if piCurQuestion < piNumQuestions then
  446.     piCurQuestion = piCurQuestion + 1
  447.     mStartNewQuestion(me)
  448.     mResetAnsweredQuestion(me)
  449.     mSetButtonState(me)
  450.   else
  451.     if voidp(poOwner) then
  452.       mHide(poNext)
  453.       mHide(poPrev)
  454.       mSetMemberName(poTop, string(pzEvalType) & "Summary")
  455.       mSetEvent(poTop, #returnToSummary)
  456.       mDisplaySummary(me)
  457.     end if
  458.   end if
  459. end
  460.  
  461. on mHandleQuizWrong me, xiAnswer
  462.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  463.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  464.     mSetButtonState(me)
  465.     setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  466.     setAt(plRightWrong, piCurQuestion, "wrong")
  467.   end if
  468. end
  469.  
  470. on mHandleQuizRight me, xiAnswer
  471.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  472.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  473.     setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  474.     setAt(plRightWrong, piCurQuestion, "right")
  475.     piTotalCorrect = piTotalCorrect + 1
  476.     member("total_correct").text = string(piTotalCorrect)
  477.     mSetButtonState(me)
  478.   end if
  479. end
  480.  
  481. on mHandleTestWrong me, xiAnswer
  482.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  483.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  484.   end if
  485.   if getAt(plRightWrong, piCurQuestion) = "right" then
  486.     piTotalCorrect = piTotalCorrect - 1
  487.   end if
  488.   setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  489.   setAt(plRightWrong, piCurQuestion, "wrong")
  490. end
  491.  
  492. on mHandleTestRight me, xiAnswer
  493.   if getAt(plRightWrong, piCurQuestion) = EMPTY then
  494.     piNumQuestonsAnswered = piNumQuestonsAnswered + 1
  495.   end if
  496.   if getAt(plRightWrong, piCurQuestion) <> "right" then
  497.     piTotalCorrect = piTotalCorrect + 1
  498.   end if
  499.   setAt(plFirstAnswer, piCurQuestion, xiAnswer)
  500.   setAt(plRightWrong, piCurQuestion, "right")
  501. end
  502.  
  503. on mHandleQuestionReview me, xiQuestion
  504.   mResetDots(poDotMan, piFirstSummarySprite, piLastSummarySprite)
  505.   mReviewAQuestion(me, xiQuestion)
  506. end
  507.  
  508. on mHandleScrollingList me, xiID
  509.   if xiID = 1 then
  510.     vsLine = mGetMouseLine(poRightQuestions)
  511.     mSetLineColour(poRightQuestions, the foreColor of member "textHiliteColour")
  512.   else
  513.     vsLine = mGetMouseLine(poWrongQuestions)
  514.     mSetLineColour(poWrongQuestions, the foreColor of member "textHiliteColour")
  515.   end if
  516.   if not ((vsLine = EMPTY) or (vsLine = VOID)) then
  517.     vsNum = char offset(" ", vsLine) + 1 to offset("-", vsLine) - 2 of vsLine
  518.     mHide(poRightQuestions)
  519.     mHide(poWrongQuestions)
  520.     deleteOne(the actorList, poRightQuestions)
  521.     deleteOne(the actorList, poWrongQuestions)
  522.     mResetDots(poDotMan, piFirstSummarySprite, piLastSummarySprite)
  523.     mReviewAQuestion(me, integer(vsNum))
  524.   end if
  525. end
  526.  
  527. on mHandleReturnToSummary me
  528.   mDisplaySummary(me)
  529. end
  530.  
  531. on mPrintEvaluation me, xzWhich
  532.   viNumChapters = count(pliChapters)
  533.   vsChapter = "<center>Chapter "
  534.   if viNumChapters > 1 then
  535.     vsChapter = "<center>Chapters: "
  536.   end if
  537.   vsChapterNum = getAt(pliChapters, 1)
  538.   repeat with i = 2 to viNumChapters
  539.     vsChapterNum = vsChapterNum & ", " & getAt(pliChapters, i)
  540.   end repeat
  541.   vsEvaluation = string(pzEvalType) & "#RETURN" & vsChapter & vsChapterNum & " " & string(pzEvalType) & "</center><BR><BR><BR><OL>"
  542.   vlLetters = ["a", "b", "c", "d", "e"]
  543.   vsOld = the itemDelimiter
  544.   the itemDelimiter = TAB
  545.   viCurline = 3
  546.   repeat with i = 1 to piNumQuestions
  547.     viCurChapter = getPropAt(plpTestQuestions, i)
  548.     viCurChapterQuestion = getAt(plpTestQuestions, i)
  549.     vsChapterQuestions = member(IntegerToString(viCurChapter, pkMaxDigits)).text
  550.     vsAQuestion = line viCurChapterQuestion of vsChapterQuestions
  551.     vlAnswerOrder = getAt(plQuestionsAnswerOrder, i)
  552.     vsResult = getAt(plRightWrong, i)
  553.     vsEvaluation = vsEvaluation & "<LI>" & item 1 of vsAQuestion & "<BR><BR>"
  554.     if xzWhich = #clean then
  555.       vsEvaluation = vsEvaluation & "<OL TYPE=" & "a" & ">"
  556.     else
  557.       vsEvaluation = vsEvaluation & "<OL>"
  558.     end if
  559.     delete item 1 of vsAQuestion
  560.     if item 1 of vsAQuestion <> EMPTY then
  561.       vlAnswerOrder = GetListFrom1toX(piNumAnswers)
  562.       viRight = value(item 1 of vsAQuestion)
  563.     else
  564.       viRight = 1
  565.     end if
  566.     delete item 1 of vsAQuestion
  567.     case xzWhich of
  568.       #clean:
  569.         repeat with j = 1 to the number of items in vsAQuestion
  570.           viWhichAnswer = getAt(vlAnswerOrder, j)
  571.           vsEvaluation = vsEvaluation & "<LI>" & item viWhichAnswer of vsAQuestion
  572.         end repeat
  573.       #result:
  574.         viAnswer = getAt(plFirstAnswer, i)
  575.         viLetterPos = getPos(vlAnswerOrder, viAnswer)
  576.         if viLetterPos then
  577.           vsEvaluation = vsEvaluation & "Your Answer: " & getAt(vlLetters, viLetterPos) & ") " & item viAnswer of vsAQuestion & "<BR><BR>"
  578.         end if
  579.         if vsResult <> "right" then
  580.           vsEvaluation = vsEvaluation & "Correct Answer: " & getAt(vlLetters, getPos(vlAnswerOrder, viRight)) & ") " & item viRight of vsAQuestion
  581.         end if
  582.     end case
  583.     vsEvaluation = vsEvaluation & "</OL><BR><BR>"
  584.   end repeat
  585.   vsEvaluation = vsEvaluation & "</OL>"
  586.   the itemDelimiter = vsOld
  587.   alert("The new window will take a moment to open.")
  588.   gotoNetPage("javascript:doPrintable(" & QUOTE & vsEvaluation & QUOTE & ")")
  589. end
  590.  
  591. on mHandleCloseBtn me
  592.   sound close 1
  593. end
  594.  
  595. on mNotify me, xiEvent, xOpcode
  596.   case xiEvent of
  597.     #chapterSelectionClick:
  598.       mHandleChapterSelectionClick(me, xOpcode)
  599.     #numQuestionsRadioBtn:
  600.       mHandleNumQuestions(me, xOpcode)
  601.     #mStartBtnClick:
  602.       mHandleStartBtnClick(me, xOpcode)
  603.     #mPrintBtnClick:
  604.       mHandlePrintBtnClick(me, xOpcode)
  605.     #showAnswer:
  606.       mHandleShowAnswer(me, xOpcode)
  607.     #donetest:
  608.       mHandleDoneTest(me, xOpcode)
  609.     #mPrevBtnClick:
  610.       mHandlePrevBtnClick(me, xOpcode)
  611.     #mNextBtnClick:
  612.       mHandleNextBtnClick(me, xOpcode)
  613.     #quizwrong:
  614.       mHandleQuizWrong(me, xOpcode)
  615.     #quizright:
  616.       mHandleQuizRight(me, xOpcode)
  617.     #testright:
  618.       mHandleTestRight(me, xOpcode)
  619.     #testwrong:
  620.       mHandleTestWrong(me, xOpcode)
  621.     #questionReview:
  622.       mHandleQuestionReview(me, xOpcode)
  623.     #TextFieldMouseDown:
  624.       mHandleScrollingList(me, xOpcode)
  625.     #returnToSummary:
  626.       mHandleReturnToSummary(me)
  627.     #close:
  628.       mHandleCloseBtn(me, xOpcode)
  629.     #printDone:
  630.       mDonePrint(me)
  631.   end case
  632. end
  633.  
  634. on mCleanUp me
  635.   if not voidp(poQuestionTemplate) then
  636.     mCleanUp(poQuestionTemplate)
  637.   end if
  638.   poQuestionTemplate = VOID
  639.   mResetDots(poDotMan)
  640.   poDotMan = VOID
  641.   plRightWrong = []
  642.   plQuestionsAnswerOrder = []
  643.   plFirstAnswer = []
  644.   pliChapters = []
  645.   poNumQuestionsRadio = VOID
  646.   plpTestQuestions = []
  647.   poRightQuestions = VOID
  648.   poWrongQuestions = VOID
  649. end
  650.